package de.sendorian.app.forumArchive.repository;

import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Component;

import de.sendorian.app.forumArchive.domain.Forum;


@Component("forumRepository")
public class ForumRepositoryImpl extends RepositoryBase<Forum> implements ForumRepository {

    public ForumRepositoryImpl() {
        super(Forum.class);
    }


    /* (non-Javadoc)
     * @see de.sendorian.app.forumArchive.repository.IForumRepository#findByName(java.lang.String)
     */
    public Forum findByName(String name) {
        try {
            return findByUniqueAttribute("name", name);
        } catch (EmptyResultDataAccessException e) {
            logger.debug("No Forum found with name " + name);
        }
        return null;
    }
}
